package blackithei.TCP;

import java.io.*;
import java.net.Socket;

//读取本地文件 传输并反馈
public class ClientDemo3 {
    public static void main(String[] args) throws IOException {
        Socket so=new Socket("127.0.1",10001);
        //读取本地文件
        BufferedInputStream bf=new BufferedInputStream(new FileInputStream("day15\\change.doc"));
        //创建网络流
        BufferedOutputStream buf=new BufferedOutputStream(so.getOutputStream());
        //读写数据
        int by;
        while((by=bf.read())!=-1){
            buf.write(by);
        }
        so.shutdownOutput();

        //接收反馈
        BufferedReader br=new BufferedReader(new InputStreamReader(so.getInputStream()));
        String line;
        while((line=br.readLine())!=null){
            System.out.println(line);
        }
        br.close();

       // buf.close();
        bf.close();
        so.close();
    }
}
